#include "ColDesc.h"
#include "scImpl.h"

#define FCT "ColDesc::ColDesc"
ColDesc::ColDesc(QString techName, QString name, int rawAttrFunct, PkType target, int rawAttrDtype) :
	techName(techName), name(name), target(target)
{
	//ctrc(Trc::WORK,APP,FCT)<<endl;
	funct=(AttrFunct)rawAttrFunct;
	switch(funct)
	{
	case AFUNCT_UNDEF:
	case AFUNCT_PK:
	case AFUNCT_IK:
	case AFUNCT_IKS:
	case AFUNCT_IKS2:
	case AFUNCT_FPK:
	case AFUNCT_FIK:
	case AFUNCT_DATA:
	case AFUNCT_LUT:
		break;
	default:
	{
		ostringstream os;
		os <<FCT<<": unknown AttrFunct "<<rawAttrFunct;
		throw new AppException(os.str().c_str(), true);
	}
	}
	dtype=(AttrDtype)rawAttrDtype;
	switch(dtype)
	{
	case ADTYPE_UNDEF:
	case ADTYPE_I32S:
	case ADTYPE_F64:
	case ADTYPE_STRASC:
	case ADTYPE_STRUTF8:
	case ADTYPE_DBKEY:
	case ADTYPE_DATIM:
		break;
	default:
	{
		ostringstream os;
		os <<FCT<<": unknown AttrDtype "<<rawAttrDtype;
		throw new AppException(os.str().c_str(), true);
	}
	}
}

#undef FCT
